/*
 * $Id$
 *
 * Copyright ( c ) 2014 XuNuo Corporation. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of XuNuo
 * Corporation ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with XuNuo Corporation or a XuNuo
 * authorized reseller (the "License Agreement"). XuNuo may make changes to the
 * Confidential Information from time to time. Such Confidential Information may
 * contain errors.
 *
 * EXCEPT AS EXPLICITLY SET FORTH IN THE LICENSE AGREEMENT, XuNuo DISCLAIMS ALL
 * WARRANTIES, COVENANTS, REPRESENTATIONS, INDEMNITIES, AND GUARANTEES WITH
 * RESPECT TO SOFTWARE AND DOCUMENTATION, WHETHER EXPRESS OR IMPLIED, WRITTEN OR
 * ORAL, STATUTORY OR OTHERWISE INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A
 * PARTICULAR PURPOSE. XuNuo DOES NOT WARRANT THAT END USER'S USE OF THE
 * SOFTWARE WILL BE UNINTERRUPTED, ERROR FREE OR SECURE.
 *
 * XuNuo SHALL NOT BE LIABLE TO END USER, OR ANY OTHER PERSON, CORPORATION OR
 * ENTITY FOR INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL
 * DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR USE, WHETHER IN AN
 * ACTION IN CONTRACT, TORT OR OTHERWISE, EVEN IF XuNuo HAS BEEN ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES. XuNuo' TOTAL LIABILITY TO END USER SHALL NOT
 * EXCEED THE AMOUNTS PAID FOR THE XuNuo SOFTWARE BY END USER DURING THE PRIOR
 * TWELVE (12) MONTHS FROM THE DATE IN WHICH THE CLAIM AROSE.  BECAUSE SOME
 * STATES OR JURISDICTIONS DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL
 * OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO END USER.
 *
 * Copyright version 2.0
 */
package com.th.supcom.pds.phamapply.client.widget.phamapplydetail;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.th.supcom.pds.common.utils.ClientColorDescUtils;

/**
 * 药品请领Tab页面主面板
 * 
 * @author 杨冲
 */
public class PhamApplyTabPanel extends ContentPanel
{
    private PhamApplyCollectGrid m_phamApplyCollectGrid;
    private PhamApplyDrugOffsetAdjustMainGrid m_drugOffsetAdjustMainGrid;
    private PhamApplyDetailGrid m_phamApplyDetailGrid;
    private PhamApplyButtons m_phamApplyButtons;

    /**
     * 设置请领药品汇总
     * 
     * @param phamapplyCollectGrid
     */
    public void setPhamApplyCollectGrid (PhamApplyCollectGrid phamapplyCollectGrid)
    {

        this.m_phamApplyCollectGrid = phamapplyCollectGrid;
    }

    /**
     * 设置药品冲抵调整Grid
     * 
     * @param drugOffsetAdjustMainGrid
     */
    public void setDrugOffsetAdjustMainGrid (PhamApplyDrugOffsetAdjustMainGrid drugOffsetAdjustMainGrid)
    {

        this.m_drugOffsetAdjustMainGrid = drugOffsetAdjustMainGrid;
    }

    /**
     * 设置请领药品明细
     * 
     * @param phamapplyDetailGrid
     */
    public void setPhamApplyDetailGrid (PhamApplyDetailGrid phamapplyDetailGrid)
    {

        this.m_phamApplyDetailGrid = phamapplyDetailGrid;
    }

    /**
     * 设置药品请领按钮组件
     * 
     * @param phamapplyButtons
     */
    public void setPhamApplyButtons (PhamApplyButtons phamapplyButtons)
    {

        this.m_phamApplyButtons = phamapplyButtons;
    }

    /**
     * 构造函数
     */
    public PhamApplyTabPanel ()
    {
    }

    /**
     * 初始化UI
     */
    public void initUI ()
    {
        setHeaderVisible (false);
        setLayout (new FitLayout ());
        setButtonAlign (HorizontalAlignment.CENTER);

        TabPanel tabPanel = new TabPanel ();
        tabPanel.setLayoutData (new FitLayout ());

        TabItem detailItem = new TabItem ("药品请领明细");
        detailItem.add (m_phamApplyDetailGrid);
        detailItem.setLayout (new FitLayout ());
        TabItem collectItem = new TabItem ("药品请领汇总");
        collectItem.add (m_phamApplyCollectGrid);
        collectItem.setLayout (new FitLayout ());
        TabItem offsetItem = new TabItem ("药品冲抵调整");
        offsetItem.add (m_drugOffsetAdjustMainGrid);
        offsetItem.setLayout (new FitLayout ());

        tabPanel.add (detailItem);
        tabPanel.add (collectItem);
        tabPanel.add (offsetItem);

        add (tabPanel);

        addButton (m_phamApplyButtons.getReceiveButton ());
        addButton (m_phamApplyButtons.getDetailClearBtn ());
        setBottomComponent (ClientColorDescUtils.createPhamDispenseColorDesc ());
    }
}
